package com.qidian.mes.pro.controller;

import com.qidian.mes.pojo.OrderBOM;
import com.qidian.mes.pro.service.MaterialBOMService;
import com.qidian.mes.util.dot.PagerDTO;
import com.qidian.mes.util.pojo.QdResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: CoolPro
 * @Description:
 * @Time: 2024-04-08 15:23
 **/
@RestController
@RequestMapping("/bom")
@CrossOrigin
public class BOMController {
    @Autowired
    private MaterialBOMService materialBOMService;
    @GetMapping("/queryById")
    public QdResult findByOrderId(Long woId){
        return materialBOMService.findByOrderId(woId);
    }

    @GetMapping("/queryByBomId")
    public QdResult findByBomId(Long bomId){
        System.out.println("bomId:"+bomId);
        return materialBOMService.findByBomId(bomId);
    }

    @GetMapping("/queryByPage")
    public QdResult<PagerDTO<OrderBOM>> queryPager(OrderBOM orderBOM, @RequestParam(defaultValue = "1") int start, @RequestParam(defaultValue = "10") int limit){
        return materialBOMService.queryPager(orderBOM,start,limit);
    }

}
